import os
import time

def parse_log(file_path):
    hwcxext_name = os.path.basename(file_path)
    hwcxext_name = hwcxext_name.replace("kern", "hwcxext")
    if ".txt" in hwcxext_name:
        hwcxext_name = hwcxext_name.replace(".log", "") + "_" + str(int(time.time())) + ".log"
    elif ".txt" in hwcxext_name:
        hwcxext_name = hwcxext_name.replace(".txt", "") + "_" + str(int(time.time())) + ".txt"

    hwcxext_list = []
    with open(file_path, 'r') as file:
        lines = file.readlines()
        for line in lines:
            if 'hwcxext' in line:
                hwcxext_list.append(line)

    with open(hwcxext_name, 'w') as file:
        for line in hwcxext_list:
            file.write(line)